<template>
<div>
  <h3>{{msg}}</h3>
  <table border="1" width="100%">
    <tr>
      <td>id</td>
      <td>name</td>
      <td>salary</td>
      <td>操作</td>
    </tr>
    <tr v-for="(depts,idx) in depts" :key="depts.id">
      <td>{{depts.id}}</td>
      <td>{{depts.name}}</td>
      <td>{{depts.salary}}</td>
      <td>修改删除</td>
    </tr>
  </table>
</div>
</template>

<script>
//引入axios

import axios from "axios"

//组件对象
export default {
  name: "depts",
  data(){
    return{
      msg:"用户信息",
      depts:[]
    };
  },
  created() {
    //发异常  查所有
    console.log("created")
    //axios.get("http://localhost:8080/depts/queryAll").then(res=>this.users=res.data());
    this.depts = [
      {id:11,name:"zs",salary:10100},
      {id:22,name:"ls",salary:20000},
    ];
  }

}
</script>

<style scoped>

</style>
